package leecode

import "fmt"

func middleNode(head *ListNode) *ListNode {
	dummyHead := &ListNode{}
	dummyHead.Next = head
	result := dummyHead
	cur := dummyHead
	index := 1
	for cur != nil {
		index++
		cur = cur.Next
	}
	fmt.Println(index)
	minNum := index / 2
	for i := 0; i < minNum; i++ {
		result = result.Next
	}
	return result
}
